package com.ruoyi.web.controller.caseinfo;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.web.entity.ReportSummeryEntity;
import com.ruoyi.web.service.CaseInfoService;
import com.ruoyi.web.service.ReportSummerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.time.LocalDate;
import java.util.List;

/**
 * @author ：wang.j.f
 * @description：TODO
 * @date ：Created in 2021/6/20 11:35
 * @modified By：
 * @version: 1.0$
 */
@Api("案件信息")
@RestController
@RequestMapping("/caseInfo")
public class CaseInfoController extends BaseController {

    @Autowired
    private CaseInfoService caseInfoService;
    @Autowired
    private ReportSummerService reportSummerService;

    @ApiOperation("excel导入")
    @PostMapping("/importExcel")
//    @PreAuthorize("@ss.hasPermi('cainfo:import')")
    public AjaxResult importExcel(@RequestParam("excel") MultipartFile file, LocalDate today, Integer workDays, Integer statType, HttpServletResponse response){

        // 全区应上报数量 网格员总数 * 天数
        String path = caseInfoService.importExcelToDb(file, today, workDays, statType, response);

        return AjaxResult.success("导入成功",path);
    }
}
